﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace MetaHeuristics.Aco
{
    using MetaHeuristics.Collections;

    public abstract class BaseTwoOptLocalSearch : BaseLocalSearch
    {
        public override void Search()
        {
            foreach (Ant ant in this.Aco.Ants)
                this.Search(ant);
        }

        protected abstract void Search(Ant ant);

        protected float IfSwapElements(Ant ant, int i, int j)
        {
            float currentLength = ant.Tours.Length;
            ant.Tours.Swap(i, j);
            float newLength = this.Aco.Distances.ComputeTourLength(ant.Tours);
            ant.Tours.Swap(i, j);

            return newLength - currentLength;
        }

    }
}
